<div>
 <form class="form-horizontal" role="form" name='myform' ng-init="initQuery()">
  <div class="form-ctrl md-whiteframe-z1">
    <div class="form-search" style="height:348px;"    ng-class="{true: 'shou'}[shoumun==0]"  ng-switch on="param.timeType" >

    <div>
      <label style="">业务线</label>
        <md-select ng-model="contrastive.businessLine" >
        <md-select-label>
           {{contrastive.businessLine ? _getNames(contrastive.businessLine,'businessLineName') : "全部"}}
        </md-select-label>
          <md-option ng-value="" ng-click="getBL()">全部</md-option>
          <md-option ng-value="businessLine"  ng-repeat="businessLine in businessLines" ng-click="getBL(businessLine)">{{businessLine.businessLineName}}</md-option>
        </md-select>
     </div>



      <div>
        <label style="">省公司</label>
        <md-select multiple ng-model="contrastive.province">
          <md-select-label>{{contrastive.province.length ? _getNames(contrastive.province,'provinceName',provinces) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(contrastive,'province')">全部</md-option>
          <md-option ng-value="province"   ng-repeat="province in provinces">{{province.provinceName}}</md-option>
        </md-select>
      </div>
      <div ng-if='show.channel'>
        <label style="width:70px">接入渠道</label>
        <md-select multiple ng-model="contrastive.channel"  placeholder="全部" >
            <md-select-label>{{contrastive.channel.length ? _getNames(contrastive.channel,'channelName',channels) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(contrastive,'channel')">全部</md-option>
          <md-option ng-value="channel" ng-repeat="channel in channels" >{{channel.channelName}}</md-option>
        </md-select>
   <!--      ACCESSCHANNELSQUERY -->
      </div>
      <div  ng-if='!show.channel'>
        <label style="width:70px">接入渠道</label>
        <md-select multiple ng-model="contrastive.channel" disabled placeholder="全部"  >
            <md-select-label>{{contrastive.channel.length ? _getNames(contrastive.channel,'channelName',channels) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(contrastive,'channel')">全部</md-option>
          <md-option ng-value="channel" ng-repeat="channel in channels" >{{channel.channelName}}</md-option>
        </md-select>
      </div>




     <div ng-show='show.transaction'>
      <label style="">交易类型</label>
        <md-select multiple ng-model="contrastive.transaction" >
        <md-select-label>{{contrastive.transaction.length ? _getNames(contrastive.transaction,'tradeTypeName',transactions) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(contrastive,'transaction')">全部</md-option>
          <md-option ng-value="transaction" ng-repeat="transaction in transactions">{{transaction.tradeTypeName}}</md-option>
        </md-select>
     </div>

    <div ng-show='!show.transaction'>
      <label style="">交易类型</label>
        <md-select  ng-model="contrastive.transaction"   disabled placeholder="全部" >
     </div>

      <div  ng-if='show.agency'>
        <label style=""  >机构</label>
        <md-select multiple ng-model="contrastive.agency" >
          <md-select-label>{{contrastive.agency.length ? _getNames(contrastive.agency,'organizationName',agencys) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(contrastive,'agency')">全部</md-option>
          <md-option ng-value="agency" ng-repeat="agency in agencys">{{agency.organizationName}}</md-option>
        </md-select>
      </div>


        <div ng-if='!show.agency' >
        <label style="" >机构</label>
        <md-select multiple ng-model="contrastive.agency" disabled>
          <md-select-label>{{contrastive.agency.length ? _getNames(contrastive,'agency','organizationName',agencys) : "全部"}}</md-select-label>
          <md-option ng-value="" ng-click="_checkAll(contrastive,'agency')">全部</md-option>
          <md-option ng-value="agency" ng-repeat="agency in agencys">{{agency.organizationName}}</md-option>
        </md-select>
      </div>


      <div>
        <label style="">账期</label>
          <md-select   ng-model="param.timeType">
          <md-option   ng-value="timeType.timeTypeCode"     ng-repeat="timeType in timeTypes">{{timeType.timeTypeName}}</md-option>
        </md-select>
      </div>
      <!--账期为年-->
      <div  ng-switch-default='5'>
        <md-input-container flex>
            <label style="color:black">时间段1：</label>
            <input type="number" ng-model="item.startTime"   time-validate="year"  end-time="item.startTimes" required name="startTime">
            <div ng-messages="myform.startTime.$error">
              <div ng-message="required">查询年份必填</div>
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间(起始)不应大于开始时间(结束)</div>
              <div ng-message="too-great">开始时间(起始)不应大于当前时间</div>
            </div>
        </md-input-container>
      </div>

      <div   ng-switch-default='5'>
         <md-input-container flex>
            <label >&nbsp;</label>
            <input type="number" ng-model="item.startTimes"   time-validate="year"  required  start-time='item.startTime'  name="startTimes">
            <div ng-messages="myform.startTimes.$error">
              <div ng-message="required">查询年份必填</div>
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间(结束)不应小于开始时间(起始)</div>
              <div ng-message="too-great">开始时间(结束)不应大于当前时间</div>
            </div>
        </md-input-container>
      </div>

      <div   ng-switch-default='5'>
         <md-input-container flex>
            <label style="color:black">时间段2:</label>
            <input type="number" ng-model="item.endTime"   time-validate="year"  min="1900" max="2050" end-time="item.endTimes"  required  name="endTime">
            <div ng-messages="myform.endTime.$error">
              <div ng-message="required">查询年份必填</div>
                <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">结束时间(起始)不应大于结束时间(结束)</div>
               <div ng-message="too-great">结束时间(起始)不应大于当前时间</div>
            </div>
        </md-input-container>
      </div>

      <div  ng-switch-default='5'>
         <md-input-container flex>
            <label >&nbsp;</label>
            <input type="number" ng-model="item.endTimes"    time-validate="year" min="1900" max="2050" start-time='item.endTime' required  name="endTimes">
            <div ng-messages="myform.endTimes.$error">
              <div ng-message="required">查询年份必填</div>
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">结束时间(结束)不应小于结束时间(起始)</div>
               <div ng-message="too-great">结束时间(结束)不应大于当前时间</div>
            </div>
        </md-input-container>
      </div>


      <!--账期为月-->
      <div  ng-switch-when='3'>
         <md-input-container flex>
          <label style="color:black">时间段1：</label>
          <input type="month" ng-model="item.startTime"   time-validate="month"  end-time='item.startTimes' name='startTime' required >
           <div ng-messages="myform.startTime.$error">
              <div ng-message="required">查询年份必填</div>
              <div ng-message="date">请正确输入时间</div>
              <div ng-message="time-error">开始时间(起始)不应大于开始时间(结束)</div>
              <div ng-message="too-great">开始时间(起始)不应大于当前时间</div>
           </div>
        </md-input-container>
      </div>

      <div  ng-switch-when='3'>
        <md-input-container flex>
          <label>&nbsp;</label>
          <input type="month" ng-model="item.startTimes"   time-validate="month"  start-time='item.startTime' name='startTimes'  required >
        <div ng-messages="myform.startTimes.$error">
          <div ng-message="required">查询年份必填</div>
          <div ng-message="date">请正确输入时间</div>
          <div ng-message="time-error">开始时间(结束)不应小于开始时间(起始)</div>
          <div ng-message="too-great">开始时间(结束)不应大于当前时间</div>
        </div>
        </md-input-container>
      </div>

      <div  ng-switch-when='3'>
         <md-input-container flex>
          <label style="color:black">时间段2：</label>
          <input type="month" ng-model="item.endTime"    time-validate="month"  required  end-time='item.endTimes' name='endTime'>
          <div ng-messages="myform.endTime.$error">
            <div ng-message="required">查询年份必填</div>
            <div ng-message="month">请正确输入时间</div>
            <div ng-message="time-error">结束时间(起始)不应大于结束时间(结束)</div>
               <div ng-message="too-great">结束时间(起始)不应大于当前时间</div>
         </div>
        </md-input-container>

      </div>

      <div  ng-switch-when='3'>
        <md-input-container flex>
          <label>&nbsp;</label>
          <input type="month" ng-model="item.endTimes"    time-validate="month"  start-time='item.endTime' name='endTimes' required >
            <div ng-messages="myform.endTimes.$error">
            <div ng-message="required">查询年份必填</div>
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="time-error">结束时间(结束)不应小于结束时间(起始)</div>
            <div ng-message="too-great">结束时间(结束)不应大于当前时间</div>
         </div>
        </md-input-container>
      </div>

      <!--账期为日-->
      <div  ng-switch-when='1'>
         <md-input-container flex>
          <label style="color:black;">时间段1：</label>
          <input type="date" ng-model="item.startTime"  time-validate="day" name='startTime' end-time='item.startTimes' required >
          <div ng-messages="myform.startTime.$error">
           <div ng-message="date">请正确输入时间</div>
            <div ng-message="required">查询年份必填</div>
            <div ng-message="time-error">开始时间(起始)不应大于开始时间(结束)</div>
            <div ng-message="too-great">开始时间(起始)不应大于当前时间</div>
          </div>
         </md-input-container>

      </div>

      <div  ng-switch-when='1'>
         <md-input-container flex>
          <label>&nbsp;</label>
          <input type="date" ng-model="item.startTimes"  time-validate="day" name='startTimes' required  start-time='item.startTime'>
          <div ng-messages="myform.startTimes.$error">
          <div ng-message="date">请正确输入时间</div>
          <div ng-message="required">查询年份必填</div>
         <div ng-message="time-error">开始时间(结束)不应小于开始时间(起始)</div>
          <div ng-message="too-great">开始时间(结束)不应大于当前时间</div>
          </div>
         </md-input-container>
      </div>

      <div  ng-switch-when='1'>
        <md-input-container flex>
          <label style="color:black">时间段2：</label>
          <input type="date" ng-model="item.endTime"  time-validate="day" name='endTime' end-time='item.endTimes' required >
           <div ng-messages="myform.endTime.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="required">查询年份必填</div>
            <div ng-message="time-error">结束时间(起始)不应大于结束时间(结束)</div>
            <div ng-message="too-great">结束时间(起始)不应大于当前时间</div>
          </div>
         </md-input-container>
      </div>

      <div  ng-switch-when='1'>
         <md-input-container flex>
          <label>&nbsp;</label>
          <input type="date" ng-model="item.endTimes"  time-validate="day"  start-Time='item.endTime' name='endTimes'  required >
          <div ng-messages="myform.endTimes.$error">
            <div ng-message="date">请正确输入时间</div>
            <div ng-message="required">查询年份必填</div>
            <div ng-message="time-error">结束时间(结束)不应小于结束时间(起始)</div>
            <div ng-message="too-great">结束时间(结束)不应大于当前时间</div>
          </div>
         </md-input-container>
      </div>



    <input-quarter-group ng-switch-when='4' start-title='timeTitle.start' end-title="true" start-time='item.startTime' end-time='item.startTimes'></input-quarter-group>


    <input-quarter-group ng-switch-when='4' start-title="timeTitle.end" end-title="true" start-time='item.endTime' end-time='item.endTimes'></input-quarter-group>

      <div>
        <label style="">统计方式</label>
         <md-select  ng-model="showType" >
          <md-option ng-value="showType.showTypeCode"  ng-repeat="showType in showTypes">{{showType.showTypeName}}</md-option>
        </md-select>
      </div>

      <div ng-show="showAnalysis">
        <label style="">对比方式</label>
          <md-select  ng-model="analysis" >
          <md-option ng-value="analysis.analysisCode"     ng-repeat="analysis in analysiss">{{analysis.analysisName}}</md-option>
        </md-select>
      </div>

    </div>
    <i class="glyphicon glyphicon-chevron-up shrinkage" ng-click="shoumun=0"  ng-show='flex && myform.$invalid!==true'></i>
    <md-button ng-click="dropDrowSw()"  class="md-fab md-primary md-hue-1" aria-label="Profile" ng-disabled='myform.$invalid'>
      <i class="glyphicon glyphicon-search" ng-show="shoumun==1" ></i>
      <i class="glyphicon glyphicon-arrow-down" style="margin-top:28px;"  ng-show="shoumun==0"></i>
    </md-button>
  </div>
</form>
<div class="table-info"  ng-controller='contrastiveAnalysisCharCtl'>
  <div class="menus">
    <md-button aria-label="列表" class="md-raised ico-btn" ng-click="lengthSwitch=false">
      <img src="images/tables.png">
    </md-button>
    <md-button aria-label="图表" class="md-raised ico-btn" ng-click="lengthSwitch=true">
      <img src="images/charts.png">
    </md-button>
    <form action="{{excelExport}}"  target="_black"  method="post" >
      <input type='hidden' name="data"  value='{{ExportList}}'>
      <md-button  type="submit"  class="md-raised">导出Excel</md-button>
    </form>
    <span class="division"></span>
    <md-button  aria-label="业务量" class="md-raised" style="background-color: #FF9800;color:white" ng-click="portfolioTimeQuery('业务量')">业务量</md-button>
    <md-button aria-label="订单金额" class="md-raised" style="background-color: #FF9800;color:white" ng-click="orderAmountQuery('订单金额')">订单金额
    </md-button>
    <md-button aria-label="充值金额" class="md-raised" style="background-color: #FF9800;color:white"  ng-click="payQuery('充值金额')">充值金额
    </md-button>
  </div>
    <div ng-if="lengthSwitch" style="text-align:center;">
      <h4 style="margin-top:0;font-size:large;font-weight:bold;color:black">{{seriesstateName}}业务量对比分析</h4>
    </div>
    <div class="table-detail" ng-show='showTable===true'  ng-if='lengthSwitch===false'>
      <div class="t_r">
        <table class="table table-bordered">
        <caption style="text-align:center;font-size:large;font-weight:bold;color:black">{{seriesstateName}}业务量对比分析</caption>
          <thead>
            <tr>
              <th>序号</th>
              <th>{{showText}}</th>
              <th> {{seriesstateNametitle}}</th>
              <th>{{seriesendNametitle}}</th>
              <th>对比</th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat='item in items'>
               <td>{{$index+1}}</td>
               <td >{{item.fecha}}</td>
               <td >{{item.portfolio}}</td>
               <td >{{item.portfolios}}</td>
               <td >{{item.contrastar}}%</td>
            </tr>
            <tr class='summary'>
              <td >汇总</td>
              <td></td>
              <td>{{sumportfolio}}</td>
              <td>{{sumportfolios}}</td>
              <td>{{collectAnalysis}}%</td>
            </tr>
          </tbody>
        </table>
      </div>
  </div>

   <div class="table-detail" ng-show='showTable===false'  ng-if='lengthSwitch===false'>
      <div class="t_r">
        <table class="table table-bordered">
        <caption style="text-align:center;font-size:large;font-weight:bold;color:black">{{seriesstateName}}业务量对比分析</caption>
          <thead>
          <tr>
            <th>序号</th>
            <th>省份代码</th>
            <th>省份</th>
            <th>{{seriesstateNametitle}}</th>
            <th>{{seriesendNametitle}}</th>
            <th>对比</th>
          </tr>
          </thead>
          <tbody>
          <tr ng-repeat='item in items'>
            <td>{{$index+1}}</td>
            <td >{{item.provinceCode}}</td>
            <td >{{item.provinceName}}</td>
            <td >{{item.portfolio}}</td>
            <td >{{item.portfolios}}</td>
            <td >{{item.contrastar}}%</td>
          </tr>
            <tr  class='summary'>
             <td>汇总</td>
             <td></td>
             <td></td>
             <td>{{sumportfolio}}</td>
             <td>{{sumportfolios}}</td>
             <td>{{collectAnalysis}}%</td>
            </tr>
          </tbody>
        </table>
       </div>
    </div>
  <div ng-show='lengthSwitch===true'>
      <div  id="main" style="height:500px"></div>
  </div>
</div>

